package com.lou.client.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class MyTest {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private LoadBalancerClient loadBalancerClient;

    @Autowired
    private ClientFeign clientFeign;

    @RequestMapping("/test")
    public String test(){
        return "success";
    }

    @RequestMapping("/testFeign")
    public String testFeign(){
        return clientFeign.test();
    }

    @RequestMapping("/testRestTemplate")
    public String testRestTemplate(){
        String forObject = restTemplate.getForObject("http://client/test", String.class);
        return "收到了"+forObject;
    }

}
